clear 
cd //insert the directory name//
use GINI_247427938_ReplicationData.dta
drop if attention==0
drop if duration<240 | duration>900
svyset ipaddress

***Table 1***
estpost tabstat purcS400 age female income educ religiosity turk voteAKP proUS proRUS, c(stat) stat(n mean sd min max)

***Table2***
*H1: 
bootstrap, reps(100) seed(1239): teffects ra (purcS400 turk educ religiosity income female age voteAKP proUS proRUS) (bipartisan)
teffects, coeflegend 
nlcom (_b[ATE:r1vs0.bipartisan] / _b[POmean:0.bipartisan]) 
*H2a
bootstrap, reps(100) seed(1239): teffects ra (purcS400 turk educ religiosity income female age voteAKP proUS proRUS) (multilateral)
teffects, coeflegend 
nlcom (_b[ATE:r1vs0.multilateral] / _b[POmean:0.multilateral]) 
*H2b
bootstrap, reps(100) seed(1239): teffects ra (purcS400 turk educ religiosity income female age voteAKP proUS proRUS) (comprehensive)
teffects, coeflegend 
nlcom (_b[ATE:r1vs0.comprehensive] / _b[POmean:0.comprehensive]) 
*H3
bootstrap, reps(100) seed(1239): teffects ra (purcS400 turk educ religiosity income female age voteAKP proUS proRUS) (exp_reward)
teffects, coeflegend 
nlcom (_b[ATE:r1vs0.exp_reward] / _b[POmean:0.exp_reward]) 


***Figure 1***
statsby mean=r(mean) lower=r(lb) upper=r(ub), by(treatment) clear: ci mean purcS400 if inlist(treatment, 1, 3, 5, 7, 9, 11, 13, 15, 17)

gen treatment_order = .
replace treatment_order = 1 if treatment == 1
replace treatment_order = 2 if treatment == 7
replace treatment_order = 3 if treatment == 13
replace treatment_order = 5 if treatment == 3
replace treatment_order = 6 if treatment == 9
replace treatment_order = 7 if treatment == 15
replace treatment_order = 9 if treatment == 5
replace treatment_order = 10 if treatment == 11
replace treatment_order = 11 if treatment == 17

twoway (rcap lower upper treatment_order) ///
(scatter mean treatment_order, msymbol(o)), ///
xlabel(1 "Biden" 2 "Congress" 3 "NATO" 5 "Biden" 6 "Congress" 7 "NATO"  9 "Biden" 10 "Congress" 11 "NATO", angle(45)) ///
xtitle("Targeted					GDP Shrink					Devaluation", color(red) size(medium)) ytitle("Policy Change") ///
title("") ///
legend(off)


***Figure 2***
clear 
cd //insert the directory name//
use GINI_247427938_ReplicationData.dta
drop if attention==0
drop if duration<240 | duration>900
svyset ipaddress

svy: reg purcS400 c.bipartisan##c.voteAKP educ female age turk religiosity income proUS proRUS
margins, at(voteAKP=(0 1) bipartisan=(0 1)) vsquish
marginsplot, x(bipartisan) recast(line) xlabel(0 "Biden" 1 "Bipartisan") level(95) saving(GraphH1a, replace)
margins, dydx(voteAKP) at(bipartisan=(0 1))
marginsplot, x(bipartisan) recast(line) xlabel(0 "Biden" 1 "Bipartisan") level(95) saving(GraphH1b, replace)

svy: reg purcS400 c.multilateral##c.voteAKP educ female age turk religiosity income proUS proRUS
margins, at(voteAKP=(0 1) multilateral=(0 1)) vsquish
marginsplot, x(multilateral) recast(line) xlabel(0 "Unilateral" 1 "Multilateral") level(95) saving(GraphH2aa, replace)
margins, dydx(voteAKP) at(multilateral=(0 1))
marginsplot, x(multilateral) recast(line) xlabel(0 "Unilateral" 1 "Multilateral") level(95) saving(GraphH2ab, replace)

svy: reg purcS400 c.comprehensive##c.voteAKP educ female age turk religiosity income proUS proRUS
margins, at(voteAKP=(0 1) comprehensive=(0 1)) vsquish
marginsplot, x(comprehensive) recast(line) xlabel(0 "Targeted" 1 "Comprehensive") level(95) saving(GraphH2ba, replace)
margins, dydx(voteAKP) at(comprehensive=(0 1))
marginsplot, x(comprehensive) recast(line) xlabel(0 "Targeted" 1 "Comprehensive") level(95) saving(GraphH2bb, replace)

svy: reg purcS400 c.exp_reward##c.voteAKP educ female age turk religiosity income proUS proRUS
margins, at(voteAKP=(0 1) exp_reward=(0 1)) vsquish
marginsplot, x(exp_reward) recast(line) xlabel(0 "No Reward" 1 "FTA") level(95) saving(GraphH3a, replace)
margins, dydx(voteAKP) at(exp_reward=(0 1))
marginsplot, x(exp_reward) recast(line) xlabel(0 "No Reward" 1 "FTA") level(95) saving(GraphH3b, replace)

grc1leg GraphH1a.gph GraphH2aa.gph GraphH2ba.gph GraphH3a.gph GraphH1b.gph GraphH2ab.gph GraphH2bb.gph GraphH3b.gph, col(4)


***Appendix***

*Table A1
iebaltab turk educ religiosity income female age voteAKP proUS proRUS, grpvar(exp_sanction) savetex(balancetable)
*Table A2
iebaltab turk educ religiosity income female age voteAKP proUS proRUS, grpvar(exp_sanction) savetex(balancetable2)
*Table A3
iebaltab turk educ religiosity income female age voteAKP proUS proRUS, grpvar(exp_reward) savetex(balancetable3)

*Table A4
eststo m1: svy:oprobit purcS400 c.bipartisan##c.voteAKP educ female age turk religiosity income proUS proRUS
eststo m2: svy:oprobit purcS400 c.multilateral##c.voteAKP educ female age turk religiosity income proUS proRUS
eststo m3: svy:oprobit purcS400 c.comprehensive##c.voteAKP educ female age turk religiosity income proUS proRUS		
eststo m4: svy:oprobit purcS400 c.exp_reward##c.voteAKP educ female age turk religiosity income proUS proRUS			
eststo m5: svy:regress purcS400 c.bipartisan##c.voteAKP educ female age turk religiosity income proUS proRUS
eststo m6: svy:regress purcS400 c.multilateral##c.voteAKP educ female age turk religiosity income proUS proRUS
eststo m7: svy:regress purcS400 c.comprehensive##c.voteAKP educ female age turk religiosity income proUS proRUS		
eststo m8: svy:regress purcS400 c.exp_reward##c.voteAKP educ female age turk religiosity income proUS proRUS			
esttab m1 m2 m3 m4 m5 m6 m7 m8 using "Table_MainAnalysis2.tex", tex replace b(%10.3f) se scalars("r2 \$R^2\$" "ll Log-Likelihood" "aic AIC") label starlevels(* 0.05 ** 0.01 *** 0.001) varlabels(_cons Constant)	


*Figure A1 
statsby mean=r(mean) lower=r(lb) upper=r(ub), by(treatment) clear: ci mean purcS400
twoway (rcap lower upper treatment, horizontal) ///
   (scatter treatment mean, msymbol(o)), ///
    ytitle("Support for Policy-change") xtitle("Treatment Group") ///
    title("Mean DV with 95% CI by Treatment Group") ///
    legend(off)

